package com.problem.leetcode;

/**
 * 与题目231思路一样
 *
 * @author didi
 * @DESCRIPTION
 * @create 2019-04-29 14:31
 **/

public class Problem191 {
    public int hammingWeight(int n) {
        int count = 0;
        while (n!=0) {
            n = n & (n - 1);
            ++count;
        }
        return count;
    }
}
